package scitc.alumni.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
    @Bean
    public OpenAPI springOpenAPI() {
        return new OpenAPI()
                .info(new Info().title("校友管理系统").description("后端API接口文档").version("V1.0.0"))
                .addSecurityItem(new SecurityRequirement().addList("Authorization"))
                .addServersItem(new Server().url("http://127.0.0.1:6688").description("服务器地址"))
                .components(new Components().addSecuritySchemes("Authorization",
                        new SecurityScheme().name("Authorization").type(SecurityScheme.Type.HTTP)
                                .scheme("Bearer").bearerFormat("")))
                ;

    }
}
